#!/bin/sh
#desc:Process rules
#type:local
#package:odai
RULESDIR="/etc/opendomo/rules"
BINDIR="/usr/local/bin"
PORTDIR="/var/opendomo/control"

mkdir -p $RULESDIR
cd $RULESDIR
for i in *; do
	if test "$i" != "*" ; then
		echo "Processing $i"
		if ! test -x $RULESDIR/$i; then
			chmod +x $RULESDIR/$i
		fi
		export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/opendomo:/etc/opendomo/sequences"
		if $RULESDIR/$i; then
			echo "Condition is TRUE"
			COMMAND=`grep '#command' $i | cut -f2 -d:`
			$COMMAND
		fi
	fi
done
